package com.cs.csworkflow.repository;

import com.cs.csworkflow.dbo.FormMain;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface FormMainRepository extends JpaRepository<FormMain, Long> {
    @Query(nativeQuery = true,
            value = "select * from form_main " +
            "where status = :status " +
            "and (subject like :condition " +
            "or form_num like :condition " +
            "or context like :condition) " +
            "order by commit_time desc " +
            "limit :page, :size")
    List<FormMain> findForms(@Param("status") Integer status,
            @Param("condition") String condition, int page, int size);
}
